/**
 * <copyright>
 * </copyright>
 *

 */
package net.maylander.bfcpublog.bfwb.brainfuckLanguage.util;

import java.util.List;

import net.maylander.bfcpublog.bfwb.brainfuckLanguage.*;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EObject;

/**
 * <!-- begin-user-doc -->
 * The <b>Switch</b> for the model's inheritance hierarchy.
 * It supports the call {@link #doSwitch(EObject) doSwitch(object)}
 * to invoke the <code>caseXXX</code> method for each class of the model,
 * starting with the actual class of the object
 * and proceeding up the inheritance hierarchy
 * until a non-null result is returned,
 * which is the result of the switch.
 * <!-- end-user-doc -->
 * @see net.maylander.bfcpublog.bfwb.brainfuckLanguage.BrainfuckLanguagePackage
 * @generated
 */
public class BrainfuckLanguageSwitch<T>
{
  /**
   * The cached model package
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  protected static BrainfuckLanguagePackage modelPackage;

  /**
   * Creates an instance of the switch.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public BrainfuckLanguageSwitch()
  {
    if (modelPackage == null)
    {
      modelPackage = BrainfuckLanguagePackage.eINSTANCE;
    }
  }

  /**
   * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @return the first non-null result returned by a <code>caseXXX</code> call.
   * @generated
   */
  public T doSwitch(EObject theEObject)
  {
    return doSwitch(theEObject.eClass(), theEObject);
  }

  /**
   * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @return the first non-null result returned by a <code>caseXXX</code> call.
   * @generated
   */
  protected T doSwitch(EClass theEClass, EObject theEObject)
  {
    if (theEClass.eContainer() == modelPackage)
    {
      return doSwitch(theEClass.getClassifierID(), theEObject);
    }
    else
    {
      List<EClass> eSuperTypes = theEClass.getESuperTypes();
      return
        eSuperTypes.isEmpty() ?
          defaultCase(theEObject) :
          doSwitch(eSuperTypes.get(0), theEObject);
    }
  }

  /**
   * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @return the first non-null result returned by a <code>caseXXX</code> call.
   * @generated
   */
  protected T doSwitch(int classifierID, EObject theEObject)
  {
    switch (classifierID)
    {
      case BrainfuckLanguagePackage.BRAINFUCK_PROGRAM:
      {
        BrainfuckProgram brainfuckProgram = (BrainfuckProgram)theEObject;
        T result = caseBrainfuckProgram(brainfuckProgram);
        if (result == null) result = defaultCase(theEObject);
        return result;
      }
      case BrainfuckLanguagePackage.SYMBOL_DEF:
      {
        SymbolDef symbolDef = (SymbolDef)theEObject;
        T result = caseSymbolDef(symbolDef);
        if (result == null) result = caseAbstractParamDef(symbolDef);
        if (result == null) result = defaultCase(theEObject);
        return result;
      }
      case BrainfuckLanguagePackage.ABSTRACT_MACRO_DEF:
      {
        AbstractMacroDef abstractMacroDef = (AbstractMacroDef)theEObject;
        T result = caseAbstractMacroDef(abstractMacroDef);
        if (result == null) result = defaultCase(theEObject);
        return result;
      }
      case BrainfuckLanguagePackage.REGION:
      {
        Region region = (Region)theEObject;
        T result = caseRegion(region);
        if (result == null) result = caseAbstractMacroDef(region);
        if (result == null) result = defaultCase(theEObject);
        return result;
      }
      case BrainfuckLanguagePackage.MACRO_DEF:
      {
        MacroDef macroDef = (MacroDef)theEObject;
        T result = caseMacroDef(macroDef);
        if (result == null) result = caseAbstractMacroDef(macroDef);
        if (result == null) result = defaultCase(theEObject);
        return result;
      }
      case BrainfuckLanguagePackage.PARAM_DEF:
      {
        ParamDef paramDef = (ParamDef)theEObject;
        T result = caseParamDef(paramDef);
        if (result == null) result = caseAbstractParamDef(paramDef);
        if (result == null) result = defaultCase(theEObject);
        return result;
      }
      case BrainfuckLanguagePackage.ABSTRACT_STMT:
      {
        AbstractStmt abstractStmt = (AbstractStmt)theEObject;
        T result = caseAbstractStmt(abstractStmt);
        if (result == null) result = defaultCase(theEObject);
        return result;
      }
      case BrainfuckLanguagePackage.SIMPLE_STMT:
      {
        SimpleStmt simpleStmt = (SimpleStmt)theEObject;
        T result = caseSimpleStmt(simpleStmt);
        if (result == null) result = caseAbstractStmt(simpleStmt);
        if (result == null) result = defaultCase(theEObject);
        return result;
      }
      case BrainfuckLanguagePackage.LOOP_STMT:
      {
        LoopStmt loopStmt = (LoopStmt)theEObject;
        T result = caseLoopStmt(loopStmt);
        if (result == null) result = caseAbstractStmt(loopStmt);
        if (result == null) result = defaultCase(theEObject);
        return result;
      }
      case BrainfuckLanguagePackage.MACRO_CALL:
      {
        MacroCall macroCall = (MacroCall)theEObject;
        T result = caseMacroCall(macroCall);
        if (result == null) result = caseAbstractStmt(macroCall);
        if (result == null) result = defaultCase(theEObject);
        return result;
      }
      case BrainfuckLanguagePackage.BF_VALUE:
      {
        BfValue bfValue = (BfValue)theEObject;
        T result = caseBfValue(bfValue);
        if (result == null) result = defaultCase(theEObject);
        return result;
      }
      case BrainfuckLanguagePackage.SIGNED_INT:
      {
        SignedInt signedInt = (SignedInt)theEObject;
        T result = caseSignedInt(signedInt);
        if (result == null) result = defaultCase(theEObject);
        return result;
      }
      case BrainfuckLanguagePackage.ABSTRACT_PARAM_DEF:
      {
        AbstractParamDef abstractParamDef = (AbstractParamDef)theEObject;
        T result = caseAbstractParamDef(abstractParamDef);
        if (result == null) result = defaultCase(theEObject);
        return result;
      }
      case BrainfuckLanguagePackage.BLOCK_STMT:
      {
        BlockStmt blockStmt = (BlockStmt)theEObject;
        T result = caseBlockStmt(blockStmt);
        if (result == null) result = caseAbstractStmt(blockStmt);
        if (result == null) result = defaultCase(theEObject);
        return result;
      }
      default: return defaultCase(theEObject);
    }
  }

  /**
   * Returns the result of interpreting the object as an instance of '<em>Brainfuck Program</em>'.
   * <!-- begin-user-doc -->
   * This implementation returns null;
   * returning a non-null result will terminate the switch.
   * <!-- end-user-doc -->
   * @param object the target of the switch.
   * @return the result of interpreting the object as an instance of '<em>Brainfuck Program</em>'.
   * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
   * @generated
   */
  public T caseBrainfuckProgram(BrainfuckProgram object)
  {
    return null;
  }

  /**
   * Returns the result of interpreting the object as an instance of '<em>Symbol Def</em>'.
   * <!-- begin-user-doc -->
   * This implementation returns null;
   * returning a non-null result will terminate the switch.
   * <!-- end-user-doc -->
   * @param object the target of the switch.
   * @return the result of interpreting the object as an instance of '<em>Symbol Def</em>'.
   * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
   * @generated
   */
  public T caseSymbolDef(SymbolDef object)
  {
    return null;
  }

  /**
   * Returns the result of interpreting the object as an instance of '<em>Abstract Macro Def</em>'.
   * <!-- begin-user-doc -->
   * This implementation returns null;
   * returning a non-null result will terminate the switch.
   * <!-- end-user-doc -->
   * @param object the target of the switch.
   * @return the result of interpreting the object as an instance of '<em>Abstract Macro Def</em>'.
   * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
   * @generated
   */
  public T caseAbstractMacroDef(AbstractMacroDef object)
  {
    return null;
  }

  /**
   * Returns the result of interpreting the object as an instance of '<em>Region</em>'.
   * <!-- begin-user-doc -->
   * This implementation returns null;
   * returning a non-null result will terminate the switch.
   * <!-- end-user-doc -->
   * @param object the target of the switch.
   * @return the result of interpreting the object as an instance of '<em>Region</em>'.
   * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
   * @generated
   */
  public T caseRegion(Region object)
  {
    return null;
  }

  /**
   * Returns the result of interpreting the object as an instance of '<em>Macro Def</em>'.
   * <!-- begin-user-doc -->
   * This implementation returns null;
   * returning a non-null result will terminate the switch.
   * <!-- end-user-doc -->
   * @param object the target of the switch.
   * @return the result of interpreting the object as an instance of '<em>Macro Def</em>'.
   * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
   * @generated
   */
  public T caseMacroDef(MacroDef object)
  {
    return null;
  }

  /**
   * Returns the result of interpreting the object as an instance of '<em>Param Def</em>'.
   * <!-- begin-user-doc -->
   * This implementation returns null;
   * returning a non-null result will terminate the switch.
   * <!-- end-user-doc -->
   * @param object the target of the switch.
   * @return the result of interpreting the object as an instance of '<em>Param Def</em>'.
   * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
   * @generated
   */
  public T caseParamDef(ParamDef object)
  {
    return null;
  }

  /**
   * Returns the result of interpreting the object as an instance of '<em>Abstract Stmt</em>'.
   * <!-- begin-user-doc -->
   * This implementation returns null;
   * returning a non-null result will terminate the switch.
   * <!-- end-user-doc -->
   * @param object the target of the switch.
   * @return the result of interpreting the object as an instance of '<em>Abstract Stmt</em>'.
   * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
   * @generated
   */
  public T caseAbstractStmt(AbstractStmt object)
  {
    return null;
  }

  /**
   * Returns the result of interpreting the object as an instance of '<em>Simple Stmt</em>'.
   * <!-- begin-user-doc -->
   * This implementation returns null;
   * returning a non-null result will terminate the switch.
   * <!-- end-user-doc -->
   * @param object the target of the switch.
   * @return the result of interpreting the object as an instance of '<em>Simple Stmt</em>'.
   * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
   * @generated
   */
  public T caseSimpleStmt(SimpleStmt object)
  {
    return null;
  }

  /**
   * Returns the result of interpreting the object as an instance of '<em>Loop Stmt</em>'.
   * <!-- begin-user-doc -->
   * This implementation returns null;
   * returning a non-null result will terminate the switch.
   * <!-- end-user-doc -->
   * @param object the target of the switch.
   * @return the result of interpreting the object as an instance of '<em>Loop Stmt</em>'.
   * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
   * @generated
   */
  public T caseLoopStmt(LoopStmt object)
  {
    return null;
  }

  /**
   * Returns the result of interpreting the object as an instance of '<em>Macro Call</em>'.
   * <!-- begin-user-doc -->
   * This implementation returns null;
   * returning a non-null result will terminate the switch.
   * <!-- end-user-doc -->
   * @param object the target of the switch.
   * @return the result of interpreting the object as an instance of '<em>Macro Call</em>'.
   * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
   * @generated
   */
  public T caseMacroCall(MacroCall object)
  {
    return null;
  }

  /**
   * Returns the result of interpreting the object as an instance of '<em>Bf Value</em>'.
   * <!-- begin-user-doc -->
   * This implementation returns null;
   * returning a non-null result will terminate the switch.
   * <!-- end-user-doc -->
   * @param object the target of the switch.
   * @return the result of interpreting the object as an instance of '<em>Bf Value</em>'.
   * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
   * @generated
   */
  public T caseBfValue(BfValue object)
  {
    return null;
  }

  /**
   * Returns the result of interpreting the object as an instance of '<em>Signed Int</em>'.
   * <!-- begin-user-doc -->
   * This implementation returns null;
   * returning a non-null result will terminate the switch.
   * <!-- end-user-doc -->
   * @param object the target of the switch.
   * @return the result of interpreting the object as an instance of '<em>Signed Int</em>'.
   * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
   * @generated
   */
  public T caseSignedInt(SignedInt object)
  {
    return null;
  }

  /**
   * Returns the result of interpreting the object as an instance of '<em>Abstract Param Def</em>'.
   * <!-- begin-user-doc -->
   * This implementation returns null;
   * returning a non-null result will terminate the switch.
   * <!-- end-user-doc -->
   * @param object the target of the switch.
   * @return the result of interpreting the object as an instance of '<em>Abstract Param Def</em>'.
   * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
   * @generated
   */
  public T caseAbstractParamDef(AbstractParamDef object)
  {
    return null;
  }

  /**
   * Returns the result of interpreting the object as an instance of '<em>Block Stmt</em>'.
   * <!-- begin-user-doc -->
   * This implementation returns null;
   * returning a non-null result will terminate the switch.
   * <!-- end-user-doc -->
   * @param object the target of the switch.
   * @return the result of interpreting the object as an instance of '<em>Block Stmt</em>'.
   * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
   * @generated
   */
  public T caseBlockStmt(BlockStmt object)
  {
    return null;
  }

  /**
   * Returns the result of interpreting the object as an instance of '<em>EObject</em>'.
   * <!-- begin-user-doc -->
   * This implementation returns null;
   * returning a non-null result will terminate the switch, but this is the last case anyway.
   * <!-- end-user-doc -->
   * @param object the target of the switch.
   * @return the result of interpreting the object as an instance of '<em>EObject</em>'.
   * @see #doSwitch(org.eclipse.emf.ecore.EObject)
   * @generated
   */
  public T defaultCase(EObject object)
  {
    return null;
  }

} //BrainfuckLanguageSwitch
